home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_bas
/
t2win_32.zip
/
_MISC.FRM
< prev
next >
Wrap
Text File
|
1996-05-14
|
18KB
|
673 lines
VERSION 4.00
Begin VB.Form frmMisc
BorderStyle = 4 'Fixed ToolWindow
Caption = "Miscelleanous"
ClientHeight = 4785
ClientLeft = 1890
ClientTop = 3270
ClientWidth = 7485
Height = 5190
Left = 1830
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 4785
ScaleWidth = 7485
ShowInTaskbar = 0 'False
Top = 2925
Width = 7605
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4005
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7260
End
Begin Threed.SSPanel SSPanel1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 1
Top = 0
Width = 7485
_Version = 65536
_ExtentX = 13203
_ExtentY = 847
_StockProps = 15
ForeColor = -2147483640
BackColor = 12632256
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 90
Width = 4785
End
Begin Threed.SSCommand SSCommand1
Default = -1 'True
Height = 300
Left = 6615
TabIndex = 6
Top = 90
Width = 465
_Version = 65536
_ExtentX = 820
_ExtentY = 529
_StockProps = 78
Caption = "&Go"
BevelWidth = 1
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 5
Top = 120
Width = 1275
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 0
Left = 6300
TabIndex = 4
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = "<"
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 1
Left = 7140
TabIndex = 3
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = ">"
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
End
End
Attribute VB_Name = "frmMisc"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 250
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestSwapX
Case 1
Call TestMinMax
Case 2
Call TestIncrX
Case 3
Call TestRndX
Case 4
Call TestSpellMoney
Case 5
Call TestFraction
Case 6
Call TestBaseConversion
Case 7
Call TestCombination
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_misc.t2w")
IsLoaded = True
End Sub
Private Sub SSCommand1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestSwapX()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
Dim b1 As Byte
Dim b2 As Byte
Dim i1 As Integer
Dim i2 As Integer
Dim l1 As Long
Dim l2 As Long
Dim s1 As Single
Dim s2 As Single
Dim d1 As Double
Dim d2 As Double
strResult = ""
strDisplay = ""
Str1 = "Hello"
Str2 = "World"
b1 = 0
b2 = 255
i1 = -32768
i2 = 32767
l1 = -2147483647
l2 = 2147483647
s1 = 12345.5678
s2 = 98765.4321
d1 = 12345.67890123
d2 = 98765.43210987
strDisplay = strDisplay + "SwapB of '" & b1 & " - " & b2 & "' is "
Call cSwapB(b1, b2)
strDisplay = strDisplay + "'" & b1 & " - " & b2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapI of '" & i1 & " - " & i2 & "' is "
Call cSwapI(i1, i2)
strDisplay = strDisplay + "'" & i1 & " - " & i2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapL of '" & l1 & " - " & l2 & "' is "
Call cSwapL(l1, l2)
strDisplay = strDisplay + "'" & l1 & " - " & l2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapS of '" & s1 & " - " & s2 & "' is "
Call cSwapS(s1, s2)
strDisplay = strDisplay + "'" & s1 & " - " & s2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapD of '" & d1 & " - " & d2 & "' is "
Call cSwapD(d1, d2)
strDisplay = strDisplay + "'" & d1 & " - " & d2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapStr of '" & Str1 & " - " & Str2 & "' is "
Call cSwapStr(Str1, Str2)
strDisplay = strDisplay + "'" & Str1 & " - " & Str2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay + "SwapStr of '" & Str1 & " - " & Str2 & "' is "
Call cSwapStr(Str1, Str2)
strDisplay = strDisplay + "'" & Str1 & " - " & Str2 & "'"
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cSwapD(d1, d2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestMinMax()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
lngResult = 0
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Min of '32760,1234567' is '" & cMin(32760, 1234567) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Max of '32760,1234567' is '" & cMax(32760, 1234567) & "'"
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cMax(32760, 1234567)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIncrX()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
lngResult = 0
strResult = ""
strDisplay = ""
i = 1
Call cIncrI(i)
strDisplay = strDisplay & "IncrI of '" & 1 & "' is '" & i & "'" & vbCrLf
i = 32000
Call cIncrI(i)
strDisplay = strDisplay & "IncrI of '" & 32000 & "' is '" & i & "'" & vbCrLf
i = -32768
Call cIncrI(i)
strDisplay = strDisplay & "IncrI of '" & -32768 & "' is '" & i & "'" & vbCrLf & vbCrLf
i = 1
Call cDecrI(i)
strDisplay = strDisplay & "DecrI of '" & 1 & "' is '" & i & "'" & vbCrLf
i = 32000
Call cDecrI(i)
strDisplay = strDisplay & "DecrI of '" & 32000 & "' is '" & i & "'" & vbCrLf
i = -32767
Call cDecrI(i)
strDisplay = strDisplay & "DecrI of '" & -32767 & "' is '" & i & "'" & vbCrLf & vbCrLf
lngResult = 1
Call cIncrL(lngResult)
strDisplay = strDisplay & "IncrL of '" & 1 & "' is '" & lngResult & "'" & vbCrLf
lngResult = 32000
Call cIncrL(lngResult)
strDisplay = strDisplay & "IncrL of '" & 32000 & "' is '" & lngResult & "'" & vbCrLf
lngResult = -32768
Call cIncrL(lngResult)
strDisplay = strDisplay & "IncrL of '" & -32768 & "' is '" & lngResult & "'" & vbCrLf & vbCrLf
lngResult = 1
Call cDecrL(lngResult)
strDisplay = strDisplay & "DecrL of '" & 1 & "' is '" & lngResult & "'" & vbCrLf
lngResult = 32000
Call cDecrL(lngResult)
strDisplay = strDisplay & "DecrL of '" & 32000 & "' is '" & lngResult & "'" & vbCrLf
lngResult = -32768
Call cDecrL(lngResult)
strDisplay = strDisplay & "DecrL of '" & -32768 & "' is '" & lngResult & "'"
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cIncrI(i)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRndX()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
lngResult = 0
strResult = ""
strDisplay = ""
Call cRndInit(-1)
strDisplay = "Some random Integer number" & vbCrLf & vbCrLf
For i = 1 To 2
strDisplay = strDisplay & cRndI() & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Some random Long number" & vbCrLf & vbCrLf
For i = 1 To 2
strDisplay = strDisplay & cRndL() & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Some random Single number" & vbCrLf & vbCrLf
For i = 1 To 2
strDisplay = strDisplay & cRndS() & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Some random Double number" & vbCrLf & vbCrLf
For i = 1 To 2
strDisplay = strDisplay & cRndD() & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Some random Double number between 0.0 and 1.0" & vbCrLf & vbCrLf
For i = 1 To 2
strDisplay = strDisplay & cRnd() & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lngResult = cRndL()
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSpellMoney()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Units As String
Dim Cents As String
lngResult = 0
strResult = ""
strDisplay = ""
Units = "dollars"
Cents = "cents"
strDisplay = "Spelling the following money value " & vbCrLf & vbCrLf
strDisplay = strDisplay & "4.12 is '" & cSpellMoney(4.12, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "16 is '" & cSpellMoney(16, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "25 is '" & cSpellMoney(25, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "34 is '" & cSpellMoney(34, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "43 is '" & cSpellMoney(43, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "61 is '" & cSpellMoney(61, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "98765.43 is '" & cSpellMoney(98765.43, Units, Cents) & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "123456789.75 is '" & cSpellMoney(123456789.75, Units, Cents) & "'"
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cSpellMoney(12.34, Units, Cents)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFraction()
Dim dblResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim v As Double
Dim n As Double
Dim p As Double
Dim q As Double
Dim e As Integer
Dim Str1 As String
Dim Units As String
Dim Cents As String
dblResult = 0
strResult = ""
strDisplay = ""
strDisplay = "Determining fraction part (numerator/denominator) for the following value " & vbCrLf & vbCrLf
n = 4.12
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 1.75
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 0.5
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 365.25
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 3.14
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 3.14159
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 3.14159265
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v & vbCrLf & vbCrLf
n = 0.9999999
v = cFraction(n, p, q)
strDisplay = strDisplay & n & " is " & p & " / " & q & vbCrLf
strDisplay = strDisplay & " value is " & v
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
dblResult = cFraction(n, p, q)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestBaseConversion()
Dim lngResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
lngResult = 0
strResult = ""
strDisplay = ""
For i = 1 To 34
strDisplay = strDisplay & "Convert '1234567' base 10 to base " & i & " is " & cBaseConversion("1234567", 10, i) & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cBaseConversion("123456789", 10, 10)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCombination()
Dim dblResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
dblResult = 0
strResult = ""
strDisplay = ""
For i = 0 To 10
strDisplay = strDisplay & "Combination C(42, " & i & ") is '" & cCombination(42, i) & "'" & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
For i = 42 To 32 Step -1
strDisplay = strDisplay & "Combination C(42, " & i & ") is '" & cCombination(42, i) & "'" & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
dblResult = cCombination(42, 6)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub